package com.yyn.Learning.controller;


import com.yyn.Learning.entity.EduSubject;
import com.yyn.Learning.service.EduSubjectService;
import com.yyn.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author yyn
 * @since 2022-11-16
 */
@RestController
@CrossOrigin
@RequestMapping("/Learning/subject")
public class EduSubjectController {
    @Autowired
    private EduSubjectService subjectService;
@PostMapping("addSubject")
@ApiOperation("添加学科")
    public R addSubject(MultipartFile file){
    subjectService.saveSubject(file,subjectService);
    return R.success();
}
@GetMapping("subjectList")
@ApiOperation("课程分类列表")
public R getSubjectList(){
   List list= subjectService.getAllSubjectList();
    return R.success().data("list",list);

}
}

